﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;

namespace ProjectA.Controls
{
    public class cTextBox : TextBox
    {
        public cTextBox(Point pPoint, Size sSize, Font fFont, Color? BkColor, char? PasswordCharacter)
        {
            Location = pPoint;
            Size = sSize;
            Design(fFont, BkColor, PasswordCharacter);
        }

        private void Design(Font fFont, Color? BkColor, char? PasswordCharacter)
        {
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            BorderStyle = System.Windows.Forms.BorderStyle.None;
            if(fFont != null)
                Font = fFont;
            if(BkColor != null)
                BackColor = (Color)BkColor;
            if (PasswordCharacter != null)
                PasswordChar = (char)PasswordCharacter;
            Margin = new System.Windows.Forms.Padding(0);
        }

        [Browsable(false)]
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x20;
                return cp;
            }
        }
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            // Do Nothing
        }
    }
}
